from appium.webdriver.common.appiumby import AppiumBy
from AppTest.page.base_page import BasePage


class PMainPage(BasePage):
    # 花名册
    __BUTTON_ROSTER = (AppiumBy.XPATH, "//android.view.View[@content-desc='待处理事项']/preceding-sibling::*[1]")
    # 待处理事项
    __BUTTON_PENDING = (AppiumBy.XPATH, "//android.view.View[@content-desc='待处理事项']")
    __BUTTON_PENDING_OVERTIME = (AppiumBy.XPATH, "//android.view.View[@content-desc='待处理事项']/parent::*/child::*[6]/child::*/child::*[1]")
    __BUTTON_PENDING_TODAY = (AppiumBy.XPATH, "//android.view.View[@content-desc='待处理事项']/parent::*/child::*[6]/child::*/child::*[2]")
    __BUTTON_PENDING_ADVANCE = (AppiumBy.XPATH, "//android.view.View[@content-desc='待处理事项']/parent::*/child::*[6]/child::*/child::*[3]")
    # 流程管理
    __BUTTON_MANAGE_INDUCTION = (AppiumBy.XPATH, "//android.widget.ImageView[@content-desc='入职管理']")
    __BUTTON_MANAGE_BRWORKER = (AppiumBy.XPATH, "//android.widget.ImageView[@content-desc='转正管理']")
    __BUTTON_MANAGE_QUIT = (AppiumBy.XPATH, "//android.widget.ImageView[@content-desc='离职管理']")
    __BUTTON_MANAGE_RECORD = (AppiumBy.XPATH, "//android.widget.ImageView[@content-desc='异动记录']")
    # 设置
    __BUTTON_RESPONSBILITY = (AppiumBy.XPATH, "//android.widget.ImageView[@content-desc='应用负责人']")
    __BUTTON_REMIND = (AppiumBy.XPATH, "//android.widget.ImageView[@content-desc='提醒设置']")

    # 跳转
    def to_roster(self):
        self.do_click(self.__BUTTON_ROSTER)

    def to_pending(self):
        self.do_click(self.__BUTTON_PENDING)

    def to_pending_overtime(self):
        self.do_click(self.__BUTTON_PENDING_OVERTIME)

    def to_pending_today(self):
        self.do_click(self.__BUTTON_PENDING_TODAY)

    def to_pending_advance(self):
        self.do_click(self.__BUTTON_PENDING_ADVANCE)

    def to_manage_induction(self):
        self.do_click(self.__BUTTON_MANAGE_INDUCTION)

    def to_manage_brworker(self):
        self.do_click(self.__BUTTON_MANAGE_BRWORKER)

    def to_manage_quit(self):
        self.do_click(self.__BUTTON_MANAGE_QUIT)

    def to_manage_record(self):
        self.do_click(self.__BUTTON_MANAGE_RECORD)

    def to_responsbility(self):
        self.do_click(self.__BUTTON_RESPONSBILITY)

    def to_remind(self):
        self.do_click(self.__BUTTON_REMIND)


